#include <stdio.h>
#define L 1000001

int data[L] = {0};
int id[L] = {0};
int b = 0;

int getid(int lb, int rb, int t)
{
    if (lb == rb)
    {
        return -1;
    }
    if (data[lb] == t)
    {
        return id[lb];
    }
    int cb = (rb - lb) / 2;
    if (data[cb] > t)
    {
        return getid(lb + 1, cb, t);
    }
    else if (data[cb] < t)
    {
        return getid(cb, rb - 1, t);
    }
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i < n + 1; ++i)
    {
        int t;
        scanf("%d", &t);
        if (data[b] != t)
        {
            data[++b] = t;
            id[b] = i;
        }
    }
    for (int i = 0; i < m; ++i)
    {
        int t;
        scanf("%d", &t);
        printf("%d ", getid(1, b, t));
    }
    return 0;
}